<template>
	<slot :controller="controller" :store="store" :model="model">
    <AppForm
		ref="editForm"
        v-bind="$attrs"
		:id="controlID"
		:name="model.codeName"
		:class="classNames"
		:data="store.data"
		>
        <AppAnchor v-if="store.anchorData.length > 0" :controlID="controlID" :anchorData="store.anchorData" />
        <div class="control-content app-control-form__content">
			<AppRow :layoutOpts="{selfLayout: 'TABLE_24COL',}">
				<AppCol
				    noRoot
				    :visible="store.detailModel.ibizsample0021name.visible"
				    :layoutOpts="{parentLayout: 'TABLE_24COL',colMD: 24,}">
				    <template v-slot:default="{ slotStyle, slotClass }">
				        <slot name="ibizsample0021name"  :controller="controller" :store="store" :model="model" :slotClass="slotClass" :slotStyle="slotStyle" :actions="{ handleComponentAction }">
				            <AppFormItem 
				                name="ibizsample0021name"
				                :slotStyle="slotStyle"
				                :slotClass="slotClass" 
				                :label="$t('DEF.LNAME.IBIZSAMPLE0021NAME', '订单名称')"
				                labelPos="LEFT" 
				                :labelWidth="130" 
				                :showLabel="true"
				                :enableAnchor="false" 
				                :rules="store.detailModel.ibizsample0021name.valueRule"
				                :emptyCaption="false">
				                <div class="form-editor-container">
				                    <slot name="ibizsample0021nameEditor"  :controller="controller" :store="store" :model="model" :actions="{ handleComponentAction }">
				                        <AppSpan
				                            :context="store.context"
				                            :viewParams="store.viewParams"
				                            :dataType="25"
				                            v-bind="{ editorType: 'SPAN', }"
				                            deMajorField=""
				                            editorType="SPAN"
				                            style=""
				                            name="ibizsample0021name"
				                            noValueShowMode="STYLE1"
				                            :value="store.data.ibizsample0021name"
				                        />
				                    </slot>
				                </div>
				            </AppFormItem>
				        </slot>
				    </template>
				</AppCol>
				<AppCol
				    noRoot
				    :visible="store.detailModel.srfwfmemo.visible"
				    :layoutOpts="{parentLayout: 'TABLE_24COL',colMD: 24,}">
				    <template v-slot:default="{ slotStyle, slotClass }">
				        <slot name="srfwfmemo"  :controller="controller" :store="store" :model="model" :slotClass="slotClass" :slotStyle="slotStyle" :actions="{ handleComponentAction }">
				            <AppFormItem 
				                name="srfwfmemo"
				                :slotStyle="slotStyle"
				                :slotClass="slotClass" 
				                label="审批意见"
				                labelPos="LEFT" 
				                :labelWidth="130" 
				                :showLabel="true"
				                :enableAnchor="false" 
				                :rules="store.detailModel.srfwfmemo.valueRule"
				                :emptyCaption="false">
				                <div class="form-editor-container">
				                    <slot name="srfwfmemoEditor"  :controller="controller" :store="store" :model="model" :actions="{ handleComponentAction }">
				                        <AppInput
				                            v-bind="{ editorType: 'TEXTAREA_10', HEIGHT: 200 }"
				                            :isTextArea10="true"
				                            type="textarea"
				                            style="height: 200px"
				                            name="srfwfmemo"
				                            :isDebounce="false"
				                            :disabled="store.detailModel.srfwfmemo.disabled"
				                            :value="store.data.srfwfmemo"
				                            @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
				                        />
				                    </slot>
				                </div>
				            </AppFormItem>
				        </slot>
				    </template>
				</AppCol>
			</AppRow>
        </div>
    </AppForm>
	</slot>
</template>
<script setup lang="ts">
// 基于template/src/widgets/{{appEntities}}/{{ctrls@FORM}}-form/{{spinalCase ctrl.codeName}}-form-base.vue.hbs生成

import { Ref } from 'vue';
import { AppAnchor } from '@components/common/anchor';
import { AppCol } from '@/components/common/col';
import { AppRow } from '@/components/common/row';
import { AppForm, AppFormPage, AppFormGroup, AppFormTabPage, AppFormItem, AppFormButton, AppFormDruipart, AppFormIframe, AppFormRaw, AppFormMdCtrl, AppFormMdCtrlRepeater } from '@components/widgets/form';
import { IEvent, EditFormActionType, IEditFormAbility, IEditFormStore, IParam } from '@/core';
import { useProps, useBasic, useAction, useController } from './operation-form-form-hook';

const editForm: Ref = ref(null);

// 输入参数
const props = defineProps(useProps());

// 基础数据
const { controlID, getClassNames, model ,useNavParamsBind, useEventBind, handleActionClick, handleComponentAction } = useBasic(props);

const emit = defineEmits<{
    (event: 'ctrl-action', name: string, action: EditFormActionType, data: IParam[]): void;
    (event: 'ctrl-init', name: string, data: IEditFormAbility): void;
    (event: 'ctrl-destroy', name: string, data: IParam): void;
}>();

const evt = useEventBind(emit);
//  部件样式名
const classNames = computed(() => {
  return getClassNames(props);
});

//  表单控制器
const controller = useController(props, evt, { controlID, editForm });

useNavParamsBind(controller, props);

const store: IEditFormStore = controller.getStore();

const ctrlService = controller.getCtrlService();

onMounted(() => {
    controller.ctrlMounted();
});
onUnmounted(() => {
    controller.ctrlDestroy();
})
</script>